<?php
include($classes_path.'/class.profile.php');
include_once($classes_path.'/class.simplepie.inc');
$myprofile = new profile();
$myprofile->set_userid($user);
$myprofile->set_page($pageid);

if($_SESSION['username']) {
    if($myprofile->get_privacy() != "1" || $user == $_SESSION['userId']) {
        print('<h1>'.ucfirst($myprofile->get_name()).' profile</h1>');
        print('<img id="avatar" src="'.DATA_PATH.'/images/profiles/'.strtolower($myprofile->get_userfolder()).'/avatars/'.strtolower($myprofile->get_avatar()).'" width="100px" alt="'.ucfirst($myprofile->get_avatarComment()).'" title="'.ucfirst($myprofile->get_avatarComment()).'" />');
        print('<p>');
        print('Real name: '.ucfirst($myprofile->get_realname()).' '.ucfirst($myprofile->get_surname()).'<br />');
        print('Member since: '.date('F jS Y',strtotime($myprofile->get_joinDate())).'<br />');
        print('Profession: '.ucfirst($myprofile->get_profession()).'<br />');
        print('Operating system of choice: <a href="page/page.php?page=osinfo&amp;os='.$myprofile->get_os().'" title="'.$myprofile->get_osSummary().'">'.ucfirst($myprofile->get_os()).'</a><br />');
        print('Comments posted: '.$myprofile->get_commentCount().' ('.round($myprofile->get_commentPercentage(),3).'% of total) <span class="time">(<a href="page/page.php?page=userposts&amp;user='.strtolower($myprofile->get_username()).'">view all comments by '.ucfirst($myprofile->get_username()).'</a>)');
        print('</p>');
        if($myprofile->get_aboutMe() != "") {
            print('<h3>About me</h3>');
            print('<p>'.nl2br($myprofile->get_aboutMe()).'</p>');
        }
        if($myprofile->get_onMind() != "") {
            print('<h3>On my mind right now</h3>');
            print('<p>'.nl2br($myprofile->get_onMind()).'</p>');
        }
        if($myprofile->get_feed() != "") {
            $feed = new SimplePie($myprofile->get_feed());
            $feed->handle_content_type();
            print('<h3>'.$myprofile->get_name().' last played tracks</h3><br />');
            print('<ul class="sumlist" id="recentTracks">');
            foreach($feed->get_items() as $item) {
                print('<li><a href="' . $item->get_permalink() . '">' . $item->get_title() . '</a></li>');
            }
            print('</ul>');
        }
    }
    else {
        print('<p>This profile has been set to private access only.</p>');
    }
}
else {
    print('<p>We are very sorry, you can not view profiles unless you are a member.<br />');
    print('If you are a member please <a href="page/701/login">log in.</a></p>');
}
?>